# load packages
library(isoorbi) # for orbitrap function
library(dplyr) # for mutating data frames
library(forcats) # for recoding factors
library(ggplot2) # for data visualization
library(cowplot) # arrange multipanel plotsShot Noise Analysis
Setup
Using R version 4.5.0 (2025-04-11) , tidyverse version 2.0.0, and isoorbi version 1.4.1.1.
Trifluoroacetate (TFA)
Data from RAW (recommended)
# read files
raw_files <-
"data/shot_noise/tfa" |>
orbi_find_raw() |>
orbi_read_raw()
# aggregate data
raw_agg <- raw_files |> orbi_aggregate_raw()# fetch dataset of interest and calculate quants
ds <-
raw_agg |>
orbi_get_data(
file_info = c("uid", "filepath" = "file_path"),
scans = c("uid", "scan", "time.min", "tic", "it.ms", "resolution", "microscans"),
peaks = everything()
) |>
rename("filename" = "uid", "scan.no" = "scan") |>
mutate(filename = gsub("\\.raw", "", filename)) |>
cross_join(
readr::read_tsv("data/shot_noise/tfa/isotopologs.tsv",
show_col_types = FALSE) |>
rename("compound" = "#Compound", "isotopocule" = "isotopolog")
) |>
filter(abs(mass - mzMeasured) * 1000 < `Tolerance [mmu]`) |>
# calculate ions incremental
# todo: turn into a function (see Caj's notes on the papers)
mutate(
ions.incremental = intensity / peakNoise * 3.0 / z *
sqrt(240000 / resolution) * sqrt(microscans),
.after = "intensity"
)
# data tfa
data_tfa <-
ds |>
orbi_flag_satellite_peaks() |>
orbi_flag_weak_isotopocules(min_percent = 10) |>
orbi_flag_outliers(agc_fold_cutoff = 2) |>
orbi_define_basepeak("M0")
shot_noise_tfa <-
data_tfa |>
orbi_analyze_shot_noise() |>
orbi_export_data_to_excel("output/shot_noise_tfa.xlsx")Data from ISOX (obsolete)
# originally, this is how the data was read in
data_tfa <-
"data/shot_noise/tfa" |>
orbi_find_isox() |>
orbi_read_isox() |>
orbi_simplify_isox() |>
orbi_flag_satellite_peaks() |>
orbi_flag_weak_isotopocules(min_percent = 10) |>
orbi_flag_outliers(agc_fold_cutoff = 2) |>
orbi_define_basepeak("M0")
shot_noise_tfa <-
data_tfa |>
orbi_analyze_shot_noise() |>
orbi_export_data_to_excel("output/shot_noise_tfa.xlsx")Bonus Figure: TFA satellite peaks
data_tfa |> orbi_plot_satellite_peaks()Bonus Figure: TFA isotopocule coverage
data_tfa |> orbi_plot_isotopocule_coverage()Bonus Figure: TFA ratios
data_tfa |> orbi_plot_raw_data(y = ratio)Figure 10: TFA shotnoise vs counts/time
# individual plots
tfa_vs_ions <-
shot_noise_tfa |>
orbi_filter_isox(filename = "TFA_M0_1uscan_15kRes") |>
orbi_plot_shot_noise(x = "n_effective_ions") +
labs(title = "vs counts") +
theme(plot.title = element_text(hjust = 0.5))
tfa_vs_time <-
shot_noise_tfa |>
orbi_filter_isox(filename = "TFA_M0_1uscan_15kRes") |>
orbi_plot_shot_noise(permil_target = 1) +
labs(title = "vs time") +
theme(plot.title = element_text(hjust = 0.5))
# combine
plot_grid(
tfa_vs_ions + theme(legend.position.inside = c(0.85, 0.74)),
tfa_vs_time + theme(legend.position = "none"),
align = "h", nrow = 1, axis = "tb"
)Extended Data Figure 6: TFA shotnoise at different IT
shot_noise_tfa |>
orbi_filter_isox(filename = c("TFA_1E4_AGC", "TFA_M0_1uscan_15kRes")) |>
# change color legend
mutate(
IT_info = filename |>
fct_recode(
"IT = 0.03 ms" = "TFA_1E4_AGC",
"IT = 0.75 ms" = "TFA_M0_1uscan_15kRes"
)
) |>
orbi_plot_shot_noise(color = "IT_info") +
# wrap by the ratio label
facet_wrap(~ratio_label) +
theme(legend.position = c(0.41, 0.75))Extended Data Figure 7: TFA shotnoise at different resolutions
shot_noise_tfa |>
orbi_filter_isox(filename = c("TFA_M0_1uscan_120kRes", "TFA_M0_1uscan_15kRes")) |>
# change color legend
mutate(
res_info = filename |>
fct_recode(
"res. = 120k" = "TFA_M0_1uscan_120kRes",
"res. = 15k" = "TFA_M0_1uscan_15kRes"
)
) |>
orbi_plot_shot_noise(color = "res_info") +
# wrap by the ratio label
facet_wrap(~ratio_label) +
theme(legend.position = c(0.42, 0.75))Model Peptide (MRFA)
Data
# load, process, and export mrfa data
data_aas <-
"data/shot_noise/mrfa" |>
orbi_find_isox() |>
orbi_read_isox() |>
orbi_simplify_isox() |>
orbi_flag_satellite_peaks() |>
orbi_flag_weak_isotopocules(min_percent = 10) |>
orbi_flag_outliers(agc_fold_cutoff = 2) |>
orbi_define_basepeak("M0") |>
mutate(
compound = compound |>
fct_recode(
"Alanine" = "Ala_imm",
"Arginine" = "Arg_imm",
"Methionine" = "Met_imm",
"Phenylalanine" = "Phe_imm"
)
)
shot_noise_aas <-
data_aas |>
orbi_analyze_shot_noise() |>
orbi_export_data_to_excel("output/shot_noise_MRFA.xlsx") Table
# example of first few rows
shot_noise_aas |>
arrange(compound, isotopocule, scan.no) |>
select(compound, scan.no, time.min, isotopocule,
ratio, ratio_rel_se.permil, shot_noise.permil) |>
head(10) |>
knitr::kable()| compound | scan.no | time.min | isotopocule | ratio | ratio_rel_se.permil | shot_noise.permil |
|---|---|---|---|---|---|---|
| Alanine | 1 | 0.059 | 15N | 0.0062453 | NaN | 73.71127 |
| Alanine | 2 | 0.102 | 15N | 0.0060919 | 12.43207 | 52.42764 |
| Alanine | 3 | 0.146 | 15N | 0.0068807 | 37.74616 | 42.08467 |
| Alanine | 4 | 0.189 | 15N | 0.0059526 | 32.61878 | 36.78579 |
| Alanine | 5 | 0.233 | 15N | 0.0060549 | 26.57095 | 32.90351 |
| Alanine | 6 | 0.277 | 15N | 0.0055040 | 29.99353 | 30.32862 |
| Alanine | 7 | 0.320 | 15N | 0.0060244 | 25.50106 | 28.18264 |
| Alanine | 8 | 0.364 | 15N | 0.0065182 | 23.43771 | 26.31067 |
| Alanine | 9 | 0.408 | 15N | 0.0064846 | 21.36449 | 24.76418 |
| Alanine | 10 | 0.451 | 15N | 0.0061980 | 19.10467 | 23.50447 |
Bonus Figure: Amino Acids satellite peaks
data_aas |> orbi_plot_satellite_peaks()Bonus Figure: Amino Acids isotopocule coverage
data_aas |> orbi_plot_isotopocule_coverage()Bonus Figure: Amino Acids ratios
data_aas |> orbi_plot_raw_data(y = ratio)Extended Data Figure 8: Amino Acids Shot Noise
shot_noise_aas |>
filter(compound == "Methionine" | isotopocule != "2H") |>
orbi_plot_shot_noise()